# -*- coding: utf-8 -*-

from celery import Celery

app = Celery('app')  # 创建 Celery 实例
app.config_from_object('celery_app.config')

# pip install celery==5.1.2
# pip install eventlet==0.30.2
# pip install flower==1.0.0
# 定时脚本添加器
# celery -A celery_app.tasks beat
# 无日志任务队列
# celery -A celery_app.tasks worker -l info -P eventlet
# 有日志任务队列
# celery -A celery_app.tasks worker -l info -P eventlet --logfile=celery_worker.log
# 服务器启动celery
# celery multi start -A celery_app.tasks  -l info -P eventlet --logfile=celery.log --pidfile=celery.pid

# 修改celery之后, 重启本celery
# celery multi restart -A celery_app.tasks worker -l info -P eventlet --logfile=celery.log --pidfile=celery.pid

# web界面
# celery -A celery_app.tasks flower --port=5555

# celery全杀(服务器所有的celery) !

# ps auxww | grep 'celery' | awk '{print $2}' | xargs kill -9
